<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		if(!isset($_SESSION))
			session_start();
		if(!isset($_SESSION['lang']))
			$_SESSION['lang'] = 'en';
		
		$this->lang->load('home', 'english');		
		$this->load->model(array('Homepage'));		
	}		
	
	public function index()
	{
		$_SESSION['active'] = 1;
		$data['menu'] = $this->Template->getmenu();
		$data['content_index'] = $this->Homepage->get_indexcontent(0);
		$data['menu_footer'] = $this->Template->getmenu_footer();
		$data['company_info'] = $this->Template->getcompany_info();
		$data['page'] = 'home';
		$this->load->view('template/index', $data);
	}
	
	function services($id)
	{	
		$_SESSION['active'] = 1;
		$data['menu'] = $this->Template->getmenu();
		$data['content_index'] = $this->Homepage->get_indexcontent($id);
		$data['menu_footer'] = $this->Template->getmenu_footer();
		$data['company_info'] = $this->Template->getcompany_info();			
		$data['page'] = 'home';		
		$this->load->view('template/index',$data);
	}
	function lg($lang)
	{ 		
		$_SESSION['active'] = 1;
		if ($lang == "vn")
		{			
			$_SESSION['lang'] = 'vn';			
		}	
		if ($lang == "en")
		{
			$_SESSION['lang'] = 'en';
		}	
		
		//site_url($_SERVER['HTTP_HOST']);
		redirect($_SESSION['now_url'], 'refresh');
		//header('Location:'.$_SERVER['HTTP_HOST']); 		
				
	}

}
